<!--
 * @Author: 李天惊 uf_lee@163.com
 * @Date: 2022-11-10 16:37:30
 * @LastEditors: 李天惊 uf_lee@163.com
 * @LastEditTime: 2025-02-28 12:57:20
 * @FilePath: \global-brain\global-brain-admin\src\views\Shop\Withdrawal\components\See.vue
 * Copyright (c) 2022 by 李天惊 uf_lee@163.com, All Rights Reserved. 
-->
<script setup lang="ts">
import { PropType, ref, reactive } from 'vue'
// import { adminCsWithdrawalSeeApi } from '@/api/cs/withdrawal'
import { adminShopShopSeeApi } from '@/api/cs/shop'

import { ContentWrap } from '@/components/ContentWrap'
import { LeeSee } from '@/components/Lee/See'
// 获取字典
import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()
const dict: any = wsCache.get('dict')

const props = defineProps({
  currentRow: {
    type: Object as PropType<Nullable<any>>,
    default: () => null
  }
})

// const data = ref<any>({})

const schema = reactive<any[]>([
  {
    field: 'withdrawal_id',
    label: '主键'
  },
  {
    field: 'withdrawal_sn',
    label: '提现单编号'
  },
  {
    field: 'shop_name',
    label: '店铺名称'
  },
  {
    field: 'amount',
    label: '提现金额'
  },
  {
    field: 'status',
    label: '提现状态',
    component: 'Dict',
    componentProps: { options: dict.shop_withdrawal_status }
  },
  {
    field: 'bank_type',
    label: '银行类型',
    component: 'Dict',
    componentProps: { options: dict.bank_type }
  },
  {
    field: 'bank_account',
    label: '银行账户'
  },
  {
    field: 'bank_name',
    label: '户名'
  },
  {
    field: 'create_user_name',
    label: '创建人'
  },
  {
    field: 'create_time',
    label: '创建时间'
  }
])

const shopSchema = reactive<any[]>([
  {
    field: 'shop_name',
    label: '店铺名称'
  },
  {
    field: 'shop_logo',
    label: '店铺logo',
    component: 'Image'
  },
  {
    field: 'surplus',
    label: '余额'
  },
  {
    field: 'create_time',
    label: '创建时间'
  }
])

// const seeApi = async () => {
//   const res: any = await adminCsWithdrawalSeeApi({ withdrawal_id: props.currentRow.withdrawal_id })
//     .catch(() => {})
//     .finally(() => {})
//   if (res) {
//     data.value = res.data
//   }
// }

const shopData = ref({})
const getAdminShopShopSeeApi = async () => {
  const res: any = await adminShopShopSeeApi({
    shop_id: props.currentRow.shop_id
  })
    .catch(() => {})
    .finally(() => {})
  if (res) {
    shopData.value = res.data
  }
}

/****************************** 初始化 start ******************************/

const init = async () => {
  // 调用提现单查看详情接口
  // await seeApi()
  // 查询该店铺信息
  await getAdminShopShopSeeApi()
}
init()

/****************************** 初始化 end ******************************/
</script>

<template>
  <ContentWrap title="提现单信息">
    <LeeSee :schema="schema" :data="props.currentRow" />
  </ContentWrap>
  <ContentWrap title="当前店铺信息">
    <LeeSee :schema="shopSchema" :data="shopData" />
  </ContentWrap>
</template>
